package com.xgst.land.viewmodel

import com.hjq.http.EasyHttp
import com.hjq.http.listener.OnHttpListener
import com.xgst.land.base.BaseViewModel
import com.xgst.land.bean.PDOrderDetailBean
import com.xgst.land.http.api.RequestSampleBoxAPI
import java.lang.Exception

class InventoryOrderDetailViewModel : BaseViewModel() {
    fun reuqestSampleBox(id:String,onSuccess:(PDOrderDetailBean.DataBean)->Unit){
        showProgress()
        EasyHttp.post(this)
            .api(RequestSampleBoxAPI(id))
            .request(object : OnHttpListener<PDOrderDetailBean> {
                override fun onSucceed(result: PDOrderDetailBean) {
                    dismissProgress()
                    onSuccess(result.data)
                }

                override fun onFail(e: Exception) {
                    dismissProgress(e.message?:"请求错误")
                }
            })
    }
}

